<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <style>
        .container{
            height:200px;
            width:200px;
            border:1px solid;
            position: relative;
        }
        .center{
            height: 50px;
            width:40px;
            position:absolute;
            top:50%;
            left:50%;
            background:lightblue;
            transform: translateX(-50%) translateY(-50%)
        }
    </style>
    <div class="container">
        <div class="center"></div>
    </div>
</body>
</html>